﻿using IRepositoryDal;
using RepositoryEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RepositoryBll
{
   public  class BaseBll<T> where T : BaseDeleteEntity
    {
        private IBaseDal<T> _baseDal;
        public BaseBll(IBaseDal<T> baseDal)
        {
            _baseDal = baseDal;
        }

        //添加
        public bool Add(T addEntity)
        {
            
            return _baseDal.Add(addEntity);
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public bool Delete(string Id)
        {
            return _baseDal.Delete(Id);
        }

        /// <summary>
        /// 获取实体数据集合
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public T GetEntity(string id)
        {
            return _baseDal.GetEntity(id);
        }

        

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool UpdateEntity(T entity)
        {
            return _baseDal.Update(entity);

        }
    }
}
